irgesture 2.2.0
irgesture


IR Gesture Click

IR Gesture Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : MikroE Team
  • Date : Jan 2020.
  • Type : I2C type

Software Support

Example Description

This Click enables contactless gesture recognition: basic directional swipes (up, down, left or right).

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.IrGesture

Example Key Functions

Application Init

Initialization driver enable's - I2C, set default configuration, enable geasture sensor and start write log.

void application_init ( void )
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
IRGESTURE_MAP_MIKROBUS( cfg, MIKROBUS_1 );
irgesture_init( &irgesture, &cfg );
irgesture_default_cfg( &irgesture );
}
#define IRGESTURE_MAP_MIKROBUS(cfg, mikrobus)
Definition irgesture.h:67
void application_init(void)
Definition main.c:41

Application Task

This is a example which demonstrates the use of IR Gesture Click board. IR Gesture Click detects gestures and sends the movement to terminal every 1 second.

void application_task ( void )
{
position = irgesture_detect_gesture( &irgesture );
if ( position_old != position )
{
if ( position == IRGESTURE_FAR )
{
log_printf( &logger, " F A R \r\n" );
}
if ( position == IRGESTURE_RIGHT )
{
log_printf( &logger, " R I G H T \r\n" );
}
if ( position == IRGESTURE_LEFT )
{
log_printf( &logger, " L E F T \r\n" );
}
if ( position == IRGESTURE_UP )
{
log_printf( &logger, " U P \r\n" );
}
if ( position == IRGESTURE_DOWN )
{
log_printf( &logger, " D O W N \r\n" );
}
if ( position == IRGESTURE_NEAR )
{
log_printf( &logger, " N E A R \r\n" );
}
position_old = position;
log_printf( &logger, "--------------------\r\n" );
Delay_ms ( 1000 );
}
}
#define IRGESTURE_RIGHT
Definition irgesture.h:197
#define IRGESTURE_LEFT
Definition irgesture.h:198
#define IRGESTURE_NEAR
Definition irgesture.h:201
#define IRGESTURE_FAR
Definition irgesture.h:196
#define IRGESTURE_DOWN
Definition irgesture.h:200
#define IRGESTURE_UP
Definition irgesture.h:199
void application_task(void)
Definition main.c:67

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.